﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title></title>
	<meta http-equiv="content-type" content="text/html; charset=UTF-8" />

	<script src="../../js/scripts/boot.js" type="text/javascript"></script>
	
	<style type="text/css">
		html, body {
			margin: 0;
			padding: 0;
			border: 0;
			width: 100%;
			height: 100%;
			overflow: hidden;
		}
	</style>

</head>
<body>
 	<!--撑满页面-->
	<div class="mini-fit">
		<div id="datagrid1" class="mini-datagrid" showPager="false" url = "/document/file/queryAllFile.do"
			style="width: 100%; height: 100%;" idField="id" multiSelect="true"
		>
			<div property="columns">
				 <div type="indexcolumn" ></div>
				<div field="version" width="80" headerAlign="center" allowSort="true">版本号</div>
				<div field="fileName" width="120" headerAlign="center" allowSort="true">文档名称</div>
				<div field="type" width="80" headerAlign="center" allowSort="true" renderer="onTypesRenderer">文档类型</div>
				<div field="userNo" width="60" headerAlign="center" allowSort="true">编写人编号</div>
				<div field="userName" width="120" align="center" headerAlign="center">编写人名称</div>
				<div field="createTime" width="100" dateFormat="yyyy-MM-dd HH:mm:ss" allowSort="true" >编写时间</div>
 				<div field="check" width="100" allowSort="true" renderer="onChecksRenderer">审批状态</div>
				<div field="checkManName" width="100" allowSort="true">审批人</div>
				<div field="act" width="100" headerAlign="center" allowSort="false" name="act"
					align="center" renderer="onActionRenderer">操作</div>
			</div>
		</div>

	</div>
<script type="text/javascript">
		mini.parse();
		var grid = mini.get("datagrid1");
		var userType = '<%= session.getAttribute("userType")%>';
		var userId = '<%= session.getAttribute("userId")%>';
		
        //渲染按钮
        function onActionRenderer(e) {
            var grid = e.sender;
            var record = e.record;
            var uid = record._uid;
            var rowIndex = e.rowIndex;
            var loadUrl = "/document/file/download.do?filePath=/upload/"+record.fileName + "&fileName="+record.fileName;
            var s = '<a class="New_Button" href="'+loadUrl+'">下载</a>'
            return s;
        }
        
		function SetData(data) {
			grid.load({docId : data.docId,type: data.docType});
		}
		
        function CloseWindow(action) {            
            if (action == "close" && form.isChanged()) {
                if (confirm("数据被修改了，是否先保存？")) {
                    return false;
                }
            }
            if (window.CloseOwnerWindow) return window.CloseOwnerWindow(action);
            else window.close();            
        }
        ///////////////////////////////////////////////////////
		var checks = [{ id: 0, text: '待审批' }, { id: 1, text: '通过'}, { id: 2, text: '未通过'}];
        function onChecksRenderer(e) {
            for (var i = 0, l = checks.length; i < l; i++) {
                var g = checks[i];
                if (g.id == e.value) return g.text;
            }
            return "";
        }
		///////////////////////////////////////////////////////
        var types = [{ "id": "usa", "text": "开发进度周报" }, { "id": "cn", "text": "项目开发总结" },{ "id": "a", "text": "软件需求与开发计划" }, 
			{ "id": "b", "text": "可行性分析" },	{ "id": "c", "text": "项目开发计划" },	{ "id": "d", "text": "需求规格说明书" },
			{ "id": "e", "text": "综合测试报告" },{ "id": "f", "text": "软件设计说明书" },{ "id": "g", "text": "系统设计说明书" },
			{ "id": "h", "text": "使用说明书" }
		]
        function onTypesRenderer(e) {
            for (var i = 0, l = types.length; i < l; i++) {
                var g = types[i];
                if (g.id == e.value) return g.text;
            }
            return "";
        }
</script>

</body>
</html>